﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace B13_Ex02_David_300512340_Alexey_321203689
{
    public class SearchPostsFactory : ISearchPostBy
    {
        private eSearchPostBy m_TypeOfSearch;

        public SearchPostsFactory(eSearchPostBy i_TypeOfSearch)
        {
            this.m_TypeOfSearch = i_TypeOfSearch;
        }

        public ISearchPost SearchByAction()
        {
            ISearchPost userChoiceObject;

            switch (m_TypeOfSearch)
            {
                case eSearchPostBy.SearchByWord:
                    userChoiceObject = new SearchPostByWord();
                    break;
                case eSearchPostBy.SearchByDate:
                    userChoiceObject = new SearchPostByDate();
                    break;
                case eSearchPostBy.SearchByWordAndDate:
                    userChoiceObject = new SearchPostByWordAndDate();
                    break;
                default:
                    userChoiceObject = null;
                    break;
            }

            return userChoiceObject;
        }
    }
}
